#ifndef PRIMITIVE_H
#define PRIMITIVE_H

#include <vector>
#include <vec2.h>
#include <vec3.h>
#include <mat2.h>
#include <mat3.h>

#define DENSITY	1.0

using namespace std;

class Vertex;
class Edge;
class Triangle;

typedef vector<Vertex*> VertexList;
typedef vector<Edge*> EdgeList;
typedef vector<Triangle*> TriangleList;



class Vertex
{
public:
	Vertex();
	~Vertex();

	vec3f position;
	vec3f velocity;
	vec3f force;
	vec2f uv;
	float	mass;

	int index;
};

class Edge
{
public:
	Edge();
	~Edge();

	Vertex* vertices[2];
	Triangle* triangles[2];

	int boarder;
};

class Triangle
{
public:
	Triangle();
	~Triangle();
	void setArea();

	Vertex* vertices[3];
	Edge* edges[3];

	mat2f uvInv;

	vec3f	wu;
	vec3f	wv;
	float	wu_n2;
	float	wv_n2;

	mat3f wu_p[3];
	mat3f wv_p[3];

	float area;
};

#endif